layui.define(["jquery"], function (exports) {
  var $ = layui.jquery;
  var classify;
  //获取类型
  $.ajax({
    type: "get",
    url: ctx + "baseflow/getList",
    contentType: "application/json;charset=UTF-8",
    // success: (res) => {
    //   classify = res;
    // },
    success: function (res) {
      classify = res;
    },
  });
  //获取机构
  var orgNm;
  $.ajax({
    type: "get",
    url: ctx + "classify/getOrgList",
    contentType: "application/json;charset=UTF-8",
    // success: (res) => {
    //   orgNm = res;
    // },
    success: function (res) {
      orgNm = res;
    },
  });
  exports("api", {
    getMenus: "menu/" + currentUser.username + "?invalid_ie_cache=" + new Date().getTime(),
    //名字匹配
    nameFormate: function (data) {
      // return classify.data.rows.find((res) => {
      //   return res.billstdNo == data;
      // })?.billstdNm;
      return classify.data.find(function (res) {
        return res.billstdNo == data;
      })?.billstdNm;
    },
    //机构匹配
    getOrgNm: function (data) {
      //   return orgNm.data.find((res) => {
      //     return res.orgId == data;
      // }).shortnmT;
      return orgNm.data.find(function (res) {
        return res.orgId == data;
      })?.shortnmT;
    },
  });
});
